import { Button, DatePicker } from 'antd';
import React, { Fragment } from 'react';
import type { ReactPropTypes } from 'react';
import type { RouteChildrenProps, useRouteMatch } from 'react-router-dom';
import { useHistory, useLocation, useParams } from 'react-router-dom';

class Info extends React.Component {
  // let history,location,param;

  state = {
    num: 1,
  };

  // constructor(props: ReactPropTypes) {
  //   super(props);
  //   // history = useHistory();
  //   // location = useLocation();
  //   // param = useParams();
  // }

  // this.setState({num: this.state.num++  });

  // componentDidMount() {
  //   console.log();
  //   const { location } = this.props as RouteChildrenProps;
  //   // useRouteMatch()  获取路径后缀参数
  //   console.log(new URLSearchParams(location.search).get('name'));
  // }

  // render(): React.ReactNode {
  //   return (
  //     <Fragment>
  //       <Button>子组件按钮</Button>
  //       <DatePicker></DatePicker>
  //     </Fragment>
  //   );
  // }
  render(): React.ReactNode {
    return (
      <Fragment>
        <Button
          onClick={() => {
            this.setState({ num: this.state.num++ });
          }}
        >
          {this.state.num}
        </Button>
      </Fragment>
    );
  }
}

export default Info;
